All Questions
90 questions
1vote
2answers
144views
Saving the changes with AddSync
I'm a beginner in c# and i am having a problem in the code, i am using the Edit method as a Index, so i'm using the AddAsync, but when i run the code it just skips the line, and also its not saving. ...
1vote
1answer
49views
Controller receives unwanted/additional model data from ASP.NET MVC View
In my ASP.NET MVC solution, I have a model that contains 25 to 30 properties. These properties are used in various forms. However, one of my Edit form (that contains only 15 fields) passes the value ...
1vote
1answer
2kviews
Pass a string as parameter for a View in ASP.NET
I'm having a hard time googling this, but I can't find my issue and I find it weird as it seems this should be something really simple (Maybe i'm using bad keywords)... Anyway I have an ASP.NET ...
0votes
1answer
1kviews
ASP.NET MVC passing a value from a variable on a controller to a view
I´m trying to pass a value from a variable var profit = income - expenses that is inside of an ActionResult on controller. Does anyone know how is it possible to call this variable on a view? (With a ...
0votes
1answer
279views
How to put a link inside HTML table, when clicked on navigate to a view (ID)
MVC project. Here is my View for the search. This will display the information as the user enters his mobile nr. Js code to follow. <nav class="navbar navbar-default"> <...
0votes
1answer
740views
Access variable of one controller from another view in ASP.NET Core MVC
I am trying build a project while self learning but have been stuck in one place. I have this class Roles: namespace IC2021.Models { public partial class Roles { public Roles() ...
0votes
0answers
98views
Delete request using box modal in MVC
I have a box modal that I created in my view using HTML that is called when the user presses a button called delete if they wanted to delete a request. From here the user sees two buttons, one to ...
-1votes
1answer
74views
Upload image in asp.net mvc
I use this method to upload image and save it to a folder i created in the server : public ActionResult Create(Regional regional, HttpPostedFileBase صورة) { if (ModelState....
0votes
1answer
564views
Why my ajax sending null values to the controller?
I using AJAX to add and edit data to database. I have tried all the ways but the final value returning to my [HttpPost] action method is null. ajax file: function AddUpdateValue() { $(document)....
0votes
1answer
124views
How Controller convert JSON data from AJAX to Model instance?
Just out of curiosity. I observed that when I make POST method in AJAX. I always mention datatype:'json' and it actually works with my model instance in parameter in Controller - The URL path ...
1vote
2answers
2kviews
415 Unsupported Media Type issue in my Controller [C#]
I created an endpoint so Google can have access to some database pictures. This is how my Endpoint looks like. [HttpGet] [Route("MiniPicture")] [Produces("image/png&...
0votes
1answer
962views
how set checkbox value to checked from controller in mvc
i got a checkbox in my view and i want to set that as checked from mvc controller. Here is my checkbox <td> <input type="checkbox" name="filtroReperibilita" id="...
1vote
1answer
125views
Cast List<ViewModel> to ViewModel?
I want to preface this by saying I am new to working with models. Please forgive me if this question has a simple answer. I have been struggling to revert a listed view model back to view model. To ...
1vote
2answers
1kviews
Model comes null to controller
This is my first ask. I have 2 models for 1 view. I built the code but i have a problem. data comes null from view to controller. Models: Mom model: public class BildirimOlusturViewModel { ...
0votes
2answers
259views
MVC submit button is always submitting the first record details on POST
I have a foreach loop in MVC page. like below. But, when I am submitting the form using submit button, it is always submitting the first record. Unable to understand why it is doing that way. ...